<div class="row">
    <p id="list-title">{{.PageName}}</p>
</div>

<form id="productCategoryForm" action="{{.URL}}{{.RecordID}}?action={{.Action}}" method="post" class="post-form form-horizontal {{if .Readonly}}form-disabled{{else}}form-edit{{end}}" role="form">
    <div class="row title-action">
        {{if .RecordID}} {{if .Readonly}}
        <a href="{{.URL}}{{.RecordID}}?action=edit" class="btn btn-success fa fa-pencil pull-left form-edit-btn">&nbsp编辑</a>
        <a href="{{.URL}}?action=create" type="buttom" class="btn btn-success fa fa-plus pull-left form-create-btn">&nbsp新建</a>{{end}} {{end}}
        <button type="submit" form="productCategoryForm" class="btn btn-primary fa fa-save pull-left form-save-btn">&nbsp保存</button>
        <a href="{{.URL}}{{if .RecordID}}{{.RecordID}}?action=detail{{end}}" class="btn btn-danger fa fa-remove  pull-left form-cancel-btn">&nbsp取消</a>
        <a href="{{.URL}}" class="btn btn-info fa fa-list pull-left">&nbsp列表</a>
    </div>
    {{ .xsrf }} {{if .RecordID}}
    <input type="hidden" data-type="int" name="recordID" id="record-id" class="{{.FormField}}" value="{{.RecordID}}"> {{end}}
    <fieldset>
        <legend>基本信息</legend>
        <div class="row">
            <div class="col-md-3">
                <div class="form-group">
                    <label for="name" class="col-md-4 control-label label-start">产品类别<span class="required-input">&nbsp*</span></label>
                    <div class="col-md-8">
                        <p class="p-form-control">{{if .Category}} {{.Category.Name}} {{end}}</p>
                        <input class="form-control {{.FormField}}" data-type="string" data-oldvalue="{{.Category.Name}}" name="Name" type="text" {{if not .Readonly}}autofocus{{end}} {{if .Category}} value="{{.Category.Name}}" {{end}} />
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <div class="form-group">
                    <label for="parent" class="col-md-4 control-label label-start">上级类别</label>
                    <div class="col-md-8">
                        <p class="p-form-control">{{if and .Category .Category.Parent}} {{.Category.Parent.Name}}{{else}} - {{end}}</p>
                        <select name="Parent" data-type="int" id="parent" data-oldvalue="{{.Category.Parent.ID}}" class="form-control select-product-category {{.FormField}}">
                            {{if and .Category .Category.Parent}} 
                            <option value="{{.Category.Parent.ID}}}" selected="selected">{{.Category.Parent.Name}}</option>
                            {{end}} 
                        </select>
                    </div>
                </div>
            </div>
        </div>
    </fieldset>

</form>